
<style type="text/css">
#allmap{width:100%;height:18rem;}
		p{margin-left:5px; font-size:14px;}
</style>
<div class='fui-page  fui-page-current store-map-page' >

    <div class="fui-header">
	<div class="fui-header-left">
	    <a class="back" ng-click="goback()"></a>
	</div>
	<div class="title">stores地图</div> 
	<div class="fui-header-right">&nbsp;</div>
    </div>
    <div class='fui-content'>
	<div id='js-map' class='map-container'></div>
	<div id="allmap"></div>
	<div class='fui-footer'>
	    <div class="fui-list">
		<div class="fui-list-media">
		    <img ng-src="{{tomedia(pagedata.store.logo)}}" />
		</div>
		<div class='fui-list-inner'>
		    <div class='title'>{{pagedata.store.title}}</div>
		   
		    <div ng-show="pagedata.store.onlinetime" class='text'>营业时间: {{pagedata.store.onlinetime.start}}——{{pagedata.store.onlinetime.end}}</div>
		
		    <div ng-show="pagedata.store.tel" class='text'>Contact phone: {{pagedata.store.tel}}</div>
		  
		</div>
		
		<div ng-show="pagedata.store.tel"  class="fui-list-angle">
		    <a href="tel:{{pagedata.store.tel}}" class='external '><i class='icon icon-tongxun' style='color:green'></i></a>
		</div>

	    </div>
	</div>
    </div>
	
  <script type="text/javascript">
// 百度地图API功能
var first=scope.pagedata.store;
	var sContent =
	"<h4 style='margin:0 0 5px 0;padding:0.2em 0'>"+first.title +"</h4>" + 
	"<img style='float:right;margin:4px' id='imgDemo' src='"+first.logo+"' width='139' height='104' title='"+first.title+"'/>"
if(first.desc){ 
	+"<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>"+first.desc+"</p>"
	}
	+"<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>"+first.address+"</p>"+ 
	"</div>";
require(['map'], function(BMap){
	var map = new BMap.Map("allmap");
	var first=scope.pagedata.store;
	
	
	if(first){
	var point = new BMap.Point(first['lat_lng']['lng'], first['lat_lng']['lat']);
	}
	//alert(JSON.stringify(point));
	map.centerAndZoom(point, 15);
	// 编写自定义函数,创建标注
	function addMarker(point){
	  var marker = new BMap.Marker(point);
	  map.addOverlay(marker);
	  marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
	 // marker.addEventListener("click",getAttr);
	}
		var point = new BMap.Point(first['lat_lng']['lng'], first['lat_lng']['lat']);
		addMarker(point);
		var shop = new BMap.Marker(point);
		map.addOverlay(shop);
		map.enableScrollWheelZoom(true); 
       var infoWindow = new BMap.InfoWindow(sContent);  // 创建信息窗口对象	
	 // 
		shop.addEventListener("click", function(){  
       //alert(shop);        
	   this.openInfoWindow(infoWindow);
	   //图片加载完毕重绘infowindow
	   document.getElementById('imgDemo').onload = function (){
		   infoWindow.redraw();   //防止在网速较慢，图片未加载时，生成的信息框高度比图片的总高度小，导致图片部分被隐藏
	   }
	});	   
});

scope.loading = true;
scope.pagedata.setting=scope.pagedata.setting?scope.pagedata.setting:{}
	    // 百度地图API功能
	window.scope.location(function(re){
		//var map = new BMap.Map("allmap");
		lat_lng=re.lat_lng;
		var me_point = new BMap.Point(lat_lng.lng,lat_lng.lat);
		var me = new BMap.Marker(me_point);
		//alert(me);
		//map.addOverlay(me);
		
		var data={
		'data':re.lat_lng,
		'op':'map',
		};	
		data.callback=function(d){
		
			window.scope.pagedata.post=d.post;
			
			scope.loading = false;
			scope.$apply();
			
		}

		window.scope.post_json(data);
	},scope.pagedata.setting.no_location);
	
</script>

</div>
